/**
 * 
 */
package com.malljelly.study.validate.code;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.awt.image.BufferedImage;
import java.time.LocalDateTime;



/**
 * 图片code
 *
 */
@Data
@AllArgsConstructor
public class ImageCode  {
	
	private BufferedImage image;

	private String code;

	private LocalDateTime expireTime;

	public ImageCode(BufferedImage image, String code, int expireIn){
		this.image = image;
		this.code = code;
		this.expireTime=LocalDateTime.now().plusSeconds(expireIn);//当前日期+过期日期 是否过期
	}

	public boolean isExpried() {
		return LocalDateTime.now().isAfter(expireTime);
	}

}
